<script setup lang="ts">
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
defineProps({
  type: {
    type: String,
    validator: (value: string): boolean => {
      return ['element-plus'].includes(value)
    },
    default: 'element-plus'
  },
  icon: {type: String, required: true},
})
const elementPlusMap = new Map()
Object.entries(ElementPlusIconsVue).forEach(([key, value]) => {
  elementPlusMap.set(key, value)
})

</script>
<template>
  <el-icon v-if="type === 'element-plus'">
    <component :is="elementPlusMap.get(icon)" />
  </el-icon>
</template>
<style scoped></style>